//
//  MCThirdVRSummaryReportTableViewCell.m
//  ZXZX
//
//  Created by MC on 2018/6/14.
//  Copyright © 2018年 TLYL01. All rights reserved.
//

#import "MCThirdVRSummaryReportTableViewCell.h"
#import "MCDataTool.h"
#import "MCQiPaiReportTool.h"
@interface MCThirdVRSummaryReportTableViewCell ()

@property (nonatomic,strong)UIImageView * logoImgV;
@property (nonatomic,strong)UILabel * timeLab;

//投注金额：20000.00       中奖金额：20000.00
//打赏金额：20000.00       盈      亏：20000.00
//查看战队：战队

//投注金额：20000.00
@property (nonatomic,strong)UILabel * BetMoney;
//打赏金额：20000.00
@property (nonatomic,strong)UILabel * Rewards;



//中奖金额：20000.00
@property (nonatomic,strong)UILabel * WinMoney;
//盈      亏：20000.00
@property (nonatomic,strong)UILabel * WinLoss;

@property (nonatomic,strong)UILabel * Dailywage;//    String    其他收入

@end

@implementation MCThirdVRSummaryReportTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

- (void)initView{
    
    self.backgroundColor=[UIColor clearColor];
    CGFloat font =12;
    if (G_SCREENWIDTH<370) {
        font=10;
    }
    
    UIView * back=[[UIView alloc]init];
    [self addSubview:back];
    back.backgroundColor=[UIColor whiteColor];
    back.frame=CGRectMake(13, 0, G_SCREENWIDTH-26, GetHeightWithLineCount(VRQiPaiReportLineCount));
    back.layer.cornerRadius=6;
    back.clipsToBounds=YES;
    
    /*
     * logo
     */
    _logoImgV=[[UIImageView alloc]init];
    _logoImgV.backgroundColor=[UIColor whiteColor];
    [back addSubview:_logoImgV];
    _logoImgV.layer.cornerRadius=11;
    _logoImgV.clipsToBounds=YES;
    _logoImgV.image=[UIImage imageNamed:@"hjicon"];
    _logoImgV.frame=CGRectMake(22, 16, 22, 22);
    
    /*
     * 时间
     */
    _timeLab =[[UILabel alloc]init];
    _timeLab.textColor=RGB(46,46,46);
    _timeLab.font=[UIFont systemFontOfSize:font];
    _timeLab.text =@"加载中";
    _timeLab.textAlignment=NSTextAlignmentLeft;
    [self  addSubview:_timeLab];
    
    [_timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_logoImgV.mas_centerY).offset(0);
        make.left.equalTo(_logoImgV.mas_right).offset(7);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(20);
    }];

    UIView * centerView=[[UIView alloc]init];
    [self addSubview:centerView];
    centerView.backgroundColor=[[UIColor colorWithHexString:@"ff4b50"] colorWithAlphaComponent:0.13];//RGB(246,243,248);
    centerView.frame=CGRectMake(33, 50, G_SCREENWIDTH-60, 20+30*VRQiPaiReportLineCount);
    centerView.layer.cornerRadius=5;
    centerView.clipsToBounds=YES;
    
    //投注金额：20000.00
    UILabel * tzMoney=[self GetAdaptiveLable:GetQiPaiReportFirstLabelFrame(0, 0) AndText:@"投注金额:" andFont:font andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:tzMoney];
    UILabel * tzMoneyLabel=[self GetAdaptiveLable:GetQiPaiReportSecondLabelFrame(0, 0) AndText:@"加载中" andFont:font andTextColor:RGB(102,102,102) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:tzMoneyLabel];
    _BetMoney=tzMoneyLabel;
    
    
    
    //打赏金额：20000.00
    UILabel * home=[self GetAdaptiveLable:GetQiPaiReportFirstLabelFrame(0, 1) AndText:@"打赏金额:" andFont:font andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:home];
    UILabel * homeMoney=[self GetAdaptiveLable:GetQiPaiReportSecondLabelFrame(0, 1) AndText:@"加载中" andFont:font andTextColor:RGB(102,102,102) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:homeMoney];
    _Rewards=homeMoney;

    
    //中奖金额：20000.00
    UILabel * zhongJiang=[self GetAdaptiveLable:GetQiPaiReportFirstLabelFrame(1, 0) AndText:@"中奖金额:" andFont:font andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:zhongJiang];
    UILabel * zhongJiangMoney=[self GetAdaptiveLable:GetQiPaiReportSecondLabelFrame(1, 0) AndText:@"加载中" andFont:font andTextColor:RGB(102,102,102) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:zhongJiangMoney];
    _WinMoney=zhongJiangMoney;
    
    //其他收入
    UILabel * Dailywage=[self GetAdaptiveLable:GetQiPaiReportFirstLabelFrame(1, 1) AndText:@"其他收入:" andFont:font andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:Dailywage];
    UILabel * DailywageMoney=[self GetAdaptiveLable:GetQiPaiReportSecondLabelFrame(1, 1) AndText:@"加载中" andFont:font andTextColor:RGB(102,102,102) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:DailywageMoney];
    _Dailywage=DailywageMoney;
    _Dailywage.text=@"0";
    
    
    //盈      亏：20000.00
    UILabel * duiZhan=[self GetAdaptiveLable:GetQiPaiReportFirstLabelFrame(0, 2) AndText:@"盈      亏:" andFont:font andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:duiZhan];
    UILabel * duiZhanMoney=[self GetAdaptiveLable:GetQiPaiReportSecondLabelFrame(0, 2) AndText:@"加载中" andFont:font andTextColor:RGB(249,84,83) andTextAlignment:NSTextAlignmentLeft];
    [centerView addSubview:duiZhanMoney];
    _WinLoss=duiZhanMoney;
    
    
}


-(UILabel *)GetAdaptiveLable:(CGRect)rect AndText:(NSString *)contentStr andFont:(CGFloat)font  andTextColor:(UIColor *)textColor andTextAlignment:(NSTextAlignment)textAlignment;
{
    
    
    UILabel *contentLbl = [[UILabel alloc] initWithFrame:rect];
    contentLbl.text = contentStr;
    contentLbl.textAlignment = textAlignment;
    contentLbl.numberOfLines =0;
    contentLbl.font = [UIFont systemFontOfSize:font];
    contentLbl.textColor=textColor;
    contentLbl.clipsToBounds=YES;
    
    return contentLbl;
}


+(CGFloat)computeHeight:(id)info{
    
    return GetHeightWithLineCount(VRQiPaiReportLineCount)+10;
    //    return 150+10;
}

-(void)setDataSource:(MCThirdVRTotalMyRptModel *)dataSource{
    
    if (!dataSource) {
        return;
    }
    
    //投注金额：20000.00
    _BetMoney.text=GetRealSNum(dataSource.BetMoney);
    
    //打赏金额：20000.00
    _Rewards.text=GetRealSNum(dataSource.Rewards);
    
    
    //中奖金额：20000.00
    _WinMoney.text=GetRealSNum(dataSource.WinMoney);
    //盈      亏：20000.00
    _WinLoss.text=GetRealSNum(dataSource.WinLoss);
     [MCDataTool changeYKLabelColor:_WinLoss];
    _timeLab.text=@"合计";
    
    if (dataSource.Dailywage) {
        if (dataSource.Dailywage.length>0) {
            
            NSString *Dailywage=[NSString stringWithFormat:@"%@",dataSource.Dailywage];
            _Dailywage.text=GetRealSNum(Dailywage);
        }
    }
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end











































